Skip to content

Feat: discovery cache, get_model_info, and ModelFamily constants#63

Merged
cosminacho merged 2 commits into
mainfrom
feat/discovery-cache-and-model-info
Apr 17, 2026
Merged

Feat: discovery cache, get_model_info, and ModelFamily constants#63
cosminacho merged 2 commits into
mainfrom
feat/discovery-cache-and-model-info

Conversation

@cosminacho

Copy link
Copy Markdown
Collaborator

Summary

  • Discovery caching: get_available_models() results are now cached on UiPathBaseSettings, keyed by (base_url, org_id, tenant_id) for Platform and (base_url, org_id, tenant_id, requesting_product) for LLMGateway. Pass refresh=True to bypass the cache.
  • Centralized model lookup: New get_model_info() method on UiPathBaseSettings handles model filtering by name, vendor, and BYO connection ID — with automatic validate_byo_model() for non-UiPath-owned models. Replaces duplicated logic in the LangChain factory and LiteLLM client.
  • ModelFamily StrEnum: New constants (OPENAI, GOOGLE_GEMINI, ANTHROPIC_CLAUDE) replace bare strings and modelSubscriptionType checks for Azure vs non-Azure OpenAI routing.

Packages affected

Both core (uipath-llm-client) and langchain (uipath-langchain-client) — version bump 1.8.31.9.0.

Test plan

  • ruff check / ruff format --check / pyright — all clean
  • Full test suite: 1514 passed
  • New TestDiscoveryCache tests: cache hit, refresh=True bypass, separate caches per settings, cache key includes requesting_product
  • New TestGetModelInfo tests: name lookup, case-insensitive, unknown model error, vendor filter, BYO connection filter, UiPathOwned preference, validate_byo_model integration

🤖 Generated with Claude Code

Add caching for model discovery and centralize model lookup logic in
UiPathBaseSettings so all consumers (LangChain factory, LiteLLM client)
share the same cached discovery and filtering.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
base_url, tenant_id, organization_id, and access_token are required
for Platform settings — declare them as required fields (like LLMGateway)
instead of Optional with a validator check.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@cosminacho cosminacho merged commit d571ab0 into main Apr 17, 2026
8 checks passed
@cosminacho cosminacho deleted the feat/discovery-cache-and-model-info branch April 17, 2026 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant